package com.bodu.depress.service.impl;

import com.bodu.depress.entity.request.DepressCollectStatissticsRequest;
import com.bodu.depress.entity.vo.DepressCollectStatissticsVo;
import com.bodu.core.entity.ParamReq;
import com.bodu.depress.mapper.DepressCollectStatissticsMapper;
import com.bodu.depress.service.DepressCollectStatissticsService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

import java.util.List;

/**
* 统计数据 Service impl
* @author Administrator
*/
@Service
public class DepressCollectStatissticsServiceImpl implements DepressCollectStatissticsService {

   @Resource
   private DepressCollectStatissticsMapper depressCollectStatissticsMapper;

   @Override
   public DepressCollectStatissticsVo getModel(Long id) {
      return  depressCollectStatissticsMapper.getModel(id);
   }

   @Transactional
   @Override
   public Long save(DepressCollectStatissticsRequest request) {
      depressCollectStatissticsMapper.save(request);
      return request.getId();
   }

   @Transactional
   @Override
   public Long update(DepressCollectStatissticsRequest request) {
      depressCollectStatissticsMapper.update(request);
      return request.getId();
   }

   @Override
   public List<DepressCollectStatissticsVo> listPage(ParamReq<DepressCollectStatissticsRequest> params) {
      params.setStartIndex((params.getCurrent() -1 ) * params.getSize());
      return depressCollectStatissticsMapper.listPage(params);
   }

   @Override
   public Integer countPage(ParamReq<DepressCollectStatissticsRequest> params) {
       return depressCollectStatissticsMapper.countPage(params);
   }

   @Override
   public Integer updateDelFlagById(Long id, Integer delFlag) {
       return depressCollectStatissticsMapper.updateDelFlagById(id, delFlag);
   }

    @Override
    public DepressCollectStatissticsVo getDepressStatissticsByCollectId(Long id) {
      return depressCollectStatissticsMapper.getDepressStatissticsByCollectId(id);
    }
}
